<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<title>商品分类</title>
		<link rel="stylesheet" href="__AGENT__/css/iconfont.css" />
		<link rel="stylesheet" href="__AGENT__/css/css.css" />
	</head>

	<body>
		{include file="public/header" /}
		<div class="index_conbox">
			<div class="index_content clearfix">
				{include file="public/lefter" /}
				<div class="right">
					<div class="rigtop">
						<span class="title">商品分类</span>
					</div>
					<div class="indrig_con orders_con"  >
						<div class="zizh_btnbox">
							<button class="zizh_btn" type="button" onclick="goods_type_add()">新增分类</button>
						</div>
						<div class="help_lisbox" style="position: relative;">
							<table class="zizh_table1">
								<thead>
									<tr>
										<th class="w_10">ID</th>
										<th class="w_40">类别名</th>
										<th class="w_20">类别名</th>
										<th class="w_20">操作</th>
									</tr>
								</thead>
								<tbody id="tbody">
									{foreach name="list" item="vo"}
									<tr>
										<td>{$vo.id}</td>
										<td><img src="{$vo.logo}" class="w_20"></td>
										<td>{$vo.type_name}</td>
										<td>
											<a href="javascript:;" onclick="goods_type_update('{:url('shop/goods_type_update',['id'=>$vo.id])}')">修改</a>
											<a class="gray" href="javascript:;" onclick="goods_type_del({$vo.id})">删除</a>
										</td>
									</tr>
									{/foreach}
								</tbody>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
		{include file="public/footer" /}
	</body>

</html>
<script>
/*OEM-删除公告*/
function goods_type_del(id) {
	layer.confirm('确认要删除吗？', {
		btn: ['确定', '取消'] //按钮
	}, function() {
		$.ajax({
			type: 'get',
			url: "{:url('shop/goods_type_del')}",
			dataType: 'json',
			data: {
				id: id
			},
			success: function(data) {
				if(data.code == 200) {
					layer.msg(data.msg, {
						icon: 1,
						time: 1000
					});
					location.reload();
				} else {
					layer.msg(data.msg, {
						icon: 1,
						time: 1000
					});
				}
			},
			error: function(data) {
				console.log(data.msg);
			}
		});
	});
}
function goods_type_add() {
	layer.open({
	  type: 2,
	  title: '增加分类',
	  shadeClose: true,
	  shade: 0.8,
	  area: ['350px', '380px'],
	  content: "{:url('shop/goods_type_add')}"
	}); 
}
function goods_type_update(url) {
	layer.open({
	  type: 2,
	  title: '修改分类',
	  shadeClose: true,
	  shade: 0.8,
	  area: ['350px', '380px'],
	  content: url
	}); 
}
</script>